﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class usercontrol_dangnhap : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql = string.Format("select * from KhachHang where UserName = '{0}' and Pass = '{1}'", txtTenDangNhap.Text, txtMatKhau.Text);
        DataTable dt = Xulydulieu.ExecuteQuery(sql);
        if (dt.Rows.Count > 0)
        {
            Session["user"] = txtTenDangNhap.Text;
            Response.Redirect("~/defaut.aspx");
        }
        else
            lbThongBao.Text = "đăng nhập thất bại";
    }
    protected void lkbDangKy_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/DangKy.aspx");
    }
     
    
}